package com.woniu.learnfile.service.Impl;

import com.woniu.learnfile.service.SaveFileLocalService;
import com.woniu.learnfile.utils.FileUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * created  by woniu201
 * created in 2018/3/15
 */
@Component
public class SaveFileLocalServiceImpl implements SaveFileLocalService{

    @Value(value="${file.path}")
    private String filePath;

    @Override
    public boolean saveFile(String fileName, byte[] fileData) throws Exception {
        System.out.println(filePath);
        System.out.println(fileName);

        FileUtil fileUtil = new FileUtil();
        return fileUtil.writeFile(filePath, fileName, fileData);
    }
}
